<?php

namespace common\validate;

class TaskMember extends BaseValidate
{
    // 验证规则
    protected $rule = [];

    // Create验证场景定义
    public function sceneCreate()
    {
        return $this->append('data', 'require')
            ->append('data.executor', 'array')
            ->append('data.partner', 'array')
            ->append('data.task', 'array')
            ->append('data.task.step_type', 'require');
    }

    // Select验证场景定义
    public function sceneSelect()
    {
        return $this->append('param', 'require')
            ->append('param.page', 'array');
    }

    // UpdateStatus验证场景定义
    public function sceneUpdateStatus()
    {
        return $this->append('data.type', 'require')
            ->append('data.id', 'require')
            ->append('data.code', 'require');
    }

    // UpdateTask验证场景定义
    public function sceneUpdateTask()
    {
        return $this->append('data.task', 'require')
            ->append('data.executor', 'array')
            ->append('data.partner', 'array');
    }

    // find验证场景
    public function sceneFind()
    {
        return $this->append('param', 'require')
            ->append('param.filter.id', 'require|integer');
    }

    // AddMember验证场景定义
    public function sceneAddMember()
    {
        return $this->append('data.task_id', 'require')
            ->append('data.executor', 'array')
            ->append('data.partner', 'array');
    }

    // RemoveMember验证场景
    public function sceneRemoveMember()
    {
        return $this->append('param', 'require')
            ->append('param.filter.task_id', 'require|integer')
            ->append('param.filter.user_id', 'require|integer')
            ->append('param.filter.type', 'require');
    }

    // SelectWorkOrderUser验证场景
    public function sceneSelectWorkOrderUser()
    {
        return $this->append('param', 'require')
            ->append('param.filter.work_order_id', 'require|integer');
    }

    // AddWorkOrderUser验证场景
    public function sceneAddWorkOrderUser()
    {
        return $this->append('data.user_list', 'require|array')
            ->append('data.work_order_id', 'require|integer');
    }

    public function sceneDeleteWorkOrderUser()
    {
        return $this->append('data.user_list', 'require|array')
            ->append('data.work_order_id', 'require|integer');
    }

    // RemoveWorkOrderUser 验证场景
    public function sceneRemoveWorkOrderUser()
    {
        return $this->append('param', 'require')
            ->append('param.filter.id', 'require|array');
    }

    // AllocationWorkOrderUserV2 验证场景
    public function sceneAllocationWorkOrderUserV2()
    {
        return $this->append('data.user_list', 'require|array')
            ->append('data.work_order_id', 'require|integer');
    }

    // Delete验证场景定义
    public function sceneDelete()
    {
        return $this->append('param.filter', 'require')
            ->append('param.filter.id', 'require');
    }

    // 批量导入验证场景定义
    public function sceneBatchCreateValidate()
    {
        return $this->append('name', 'require');
    }

    // GetDeliveryVersionHistory 查找任务关联交付文件版本历史
    public function sceneGetDeliveryVersionHistory()
    {
        return $this->append('param.filter', 'require|array')
            ->append('param.page', 'require|array');
    }


}
